library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(stringr)
library(emojifont)
## Warning: package 'emojifont' was built under R version 4.3.3
library(ggtext)
## Warning: package 'ggtext' was built under R version 4.3.3
library(leaflet)
library(sf)
## Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0 ✔ readr 2.1.5
## ✔ purrr 1.0.2 ✔ tibble 3.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readr)
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:purrr':
##
## flatten
library(wordcloud)
## Warning: package 'wordcloud' was built under R version 4.3.3
## Loading required package: RColorBrewer
library(tidytext)
##Two variable comparisons data
airbnb_parsed <- airbnb_data |>
select(Name, Title, Id, `Listing URL`, Price, Beds, Baths, Bedrooms, `Average Rating`, `Number of Reviews`, `More Details`, `Listing Type`, `Room Type Category`) |>
mutate(price_parsed = parse_number(Price))
house_icon <- makeIcon(
iconUrl = "https://www.iconeasy.com/icon/png/System/Vista%20General/house.png",
iconWidth = 29,
iconHeight = 29
)
rat_icon <- makeIcon(
iconUrl = "https://icons.iconarchive.com/icons/google/noto-emoji-animals-nature/256/22251-rat-icon.png",
iconWidth = 28,
iconHeight = 28
)
leaflet() |>
addTiles() |>
setView(lng = -74.00, lat = 40.71, zoom = 12) |>
addMarkers(data = airbnb_data, lng = ~Longitude, lat = ~Latitude, icon = house_icon,
popup = ~paste("<a href='", `Listing URL`, "'><b>", Title, "</b></a>", "</br>", Name, "</br>", Price, Qualifier))|>
addMarkers(data=rats_graph, lng=~Longitude, lat=~Latitude, icon = rat_icon, popup = ~paste("squeak squeak:)"))
carrot_icon <- makeIcon(
iconUrl = "https://images.emojiterra.com/google/noto-emoji/unicode-15.1/color/svg/1f955.svg",
iconWidth = 29,
iconHeight = 29
)
leaflet() |>
addTiles() |>
setView(lng = -74.00, lat = 40.71, zoom = 12)|>
addMarkers(data=farmers_markets, lng=~longitude, lat=~latitude, icon = carrot_icon, popup = ~paste(marketname, "</br>", daysoperation, hoursoperations))
leaflet() |>
addTiles() |>
setView(lng = -74.00, lat = 40.71, zoom = 12)|>
addPolygons(data=parks_sf, color="deeppink", popup = ~paste(SIGNNAME))
word <- airbnb_data |>
select(Name) |>
mutate(Name = str_to_lower(Name),
word = str_split(Name, "\\s+"))|>
unnest(word) |>
mutate(word = str_remove_all(word, "[^[:alpha:]]")) |>
anti_join(stop_words) |>
count(word, sort=TRUE)|>
slice(2:378)
## Joining with `by = join_by(word)`
pinkalicious <- c("#FF6FFF", "#FF5D99", "hotpink", "#FFCFF7", "deeppink")
wordcloud(words = word$word, freq = word$n, min.freq = 1,
max.words = 100, random.order = FALSE, rot.per = 0.35,
colors = pinkalicious)